package org.coody.gitee.fuzzer.iface;

import org.coody.gitee.entity.GiteeEntity;
import org.coody.gitee.exception.FuzzerException;
import org.coody.gitee.util.StringUtil;

public abstract class GiteeFuzzer {
	
	public abstract void fuzzer(GiteeEntity giteeEntity) throws FuzzerException;
	
	public String getCsrfToken(String html) {
		html = StringUtil.textCutCenter(html, "<head>", "</head>");
		String[] tabs = html.split("\n");
		for (String tab : tabs) {
			if (!tab.contains("csrf-token")) {
				continue;
			}
			String line = tab;
			String csrfToken = StringUtil.textCutCenter(line, "\"", "\"");
			return csrfToken;
		}
		return null;
	}

	

}
